﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using OpenFrameworkCore.Serialize;
using System.Xml.Serialization;

namespace OpenFrameworkCore.Controls
{
	[XmlTypeAttribute()]
	public abstract class ControlBaseContext : INotifyPropertyChanged, Serializable
	{
		#region INotifyPropertyChanged Members

		public event PropertyChangedEventHandler PropertyChanged;

		#endregion

		private int zIndex;

		/// <summary>
		/// ZIndex
		/// </summary>
		[XmlAttribute]
		public int ZIndex
		{
			get
			{
				return zIndex;
			}

			set
			{
				zIndex = value;

				RaisePropertyChanged("ZIndex");
			}
		}

		private string controlClass;

		/// <summary>
		/// Control의 클래스를 나타낸다.
		/// </summary>
		[XmlAttribute]
		public string ControlClass
		{
			get
			{
				return this.controlClass;
			}
			set
			{
				controlClass = value;
			}
		}

		/// <summary>
		/// PropertyChanged 이벤트를 발생시킨다.
		/// </summary>
		/// <param name="propertyName"></param>
		protected void RaisePropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
		}
	}
}
